package headfirst.designpatterns.factory.c_pizzaaf_abstartfactory.pizzastore;

import headfirst.designpatterns.factory.c_pizzaaf_abstartfactory.b_pizza.ClamPizza;
import headfirst.designpatterns.factory.c_pizzaaf_abstartfactory.b_pizza.PepperoniPizza;
import headfirst.designpatterns.factory.c_pizzaaf_abstartfactory.b_pizza.VeggiePizza;
import headfirst.designpatterns.factory.c_pizzaaf_abstartfactory.a_ingredientFactory.ChicagoPizzaIngredientFactory;
import headfirst.designpatterns.factory.c_pizzaaf_abstartfactory.a_ingredientFactory.PizzaIngredientFactory;
import headfirst.designpatterns.factory.c_pizzaaf_abstartfactory.b_pizza.CheesePizza;
import headfirst.designpatterns.factory.c_pizzaaf_abstartfactory.b_pizza.Pizza;

public class ChicagoPizzaStore extends PizzaStore {

	/**
	 * 实现pizzaStore抽象方法
	 * @param item 披萨类型
	 * @return 披萨实体
	 */
	protected Pizza createPizza(String item) {
		Pizza pizza = null;
		PizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory();

		if (item.equals("cheese")) {

			pizza = new CheesePizza(ingredientFactory);
			pizza.setName("Chicago Style Cheese Pizza");

		} else if (item.equals("veggie")) {

			pizza = new VeggiePizza(ingredientFactory);
			pizza.setName("Chicago Style Veggie Pizza");

		} else if (item.equals("clam")) {

			pizza = new ClamPizza(ingredientFactory);
			pizza.setName("Chicago Style Clam Pizza");

		} else if (item.equals("pepperoni")) {

			pizza = new PepperoniPizza(ingredientFactory);
			pizza.setName("Chicago Style Pepperoni Pizza");

		}
		return pizza;
	}
}
